<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>对象的遍历</title>
</head>
<body>
    <script>
        let obj = {
            name:'张艺川',
            age:23,
            city:'郑州'
        }

        let keys = Object.keys(obj);
        console.log(keys);

        Object.keys(obj).forEach(attr=>{
            console.log(attr, obj[attr]);
        })

        let names = Object.getOwnPropertyNames(obj);
        console.log(names);
    </script>
</body>
</html>